package com.jicheng.config.web;

import com.jicheng.Utils.JudgeSystem;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;


/**
 * @ClassName: WebMvcConfig
 * @Description: TODO
 * @author: khz
 * @date: 2020年09月14日 14:17
 */
@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter {

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //  /home/file/**为前端URL访问路径  后面 file:xxxx为本地磁盘映射
        boolean windows = JudgeSystem.isWindows();
        if(windows){
            registry.addResourceHandler("/file/**").addResourceLocations("file:D:/");
        }else{
            registry.addResourceHandler("/file/**").addResourceLocations("file:");
        }
    }
}